package com.mju.feign.clients;

import com.mju.controller.common.JsonResult;
import com.mju.pojo.Order;
import com.mju.pojo.vo.OrderVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("order-service")
public interface OrderClient {
  // 根据订单号查询订单
  @GetMapping("/orders/queryOrderVoByOid")
  public JsonResult<List<OrderVo>> queryOrderByOid(@RequestParam("oid") Integer oid);

  // 根据oid修改订单状态 状态：0-未支付，1-已支付，2-已取消，3-已关闭，4-已完成，5-已退款，6-退款异常
  @PutMapping("/orders/updateOrderStatus/{oid}/{status}")
  public JsonResult<Void> updateOrderStatus(
      @PathVariable("oid") Integer oid, @PathVariable("status") Integer status);

  // 根据token创建订单
  @PostMapping("/orders/createOrderByToken")
  public JsonResult<Order> createOrderByToken(
      @RequestParam("aid") Integer aid,
      @RequestParam("cids") Integer[] cids,
      @RequestParam("token") String token);

}
